<?php

class Users_LoginAction extends SrsUsersBaseAction
{
	public function isSecure()
	{
		return false;
	}
	
	public function executeRead()
	{
		return 'Input';
	}

	public function executeWrite(AgaviRequestDataHolder $rd)
	{
		$user = $this->getContext()->getUser();

		try
		{
			$user->login($rd->getParameter('email', ''), $rd->getParameter('password', ''));
		}
		catch (AgaviSecurityException $x)
		{
			return 'Error';
		}

		return 'Success';
	}
}